-
Notifications
You must be signed in to change notification settings - Fork 0
homework-4 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
homework-4 #5
Conversation
|
|
||
| console.log('Категория:', key); | ||
|
|
||
| for(let i = 0; i < category[key].length; i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have to define category[key] as a variable, that variable used widely and what does it mean not really clear.
For example, take a look on line 51, what does category[key][i] refer to ? what abstraction inside?
|
|
||
| function fizzBuzz(num) { | ||
| let someRes; | ||
| if(num % 3 == 0 && num % 5 == 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was approach for FizzBuzz in class I guess you can apply it here
| function newArr(arr){ | ||
| let newArray = []; | ||
| for(let i = 0; i < arr.length; i++){ | ||
| newArray.push( typeof arr[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arr[i] - probably better to give some name to that construction
| function solution(arr) { | ||
| for (let key in arr) { | ||
| let arrKey = arr[key]; | ||
| if (Number.isNaN(arrKey.age)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNaN enough, no need refer to "Number"
|
|
||
| function solution(arr) { | ||
| for (let key in arr) { | ||
| let arrKey = arr[key]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arr[key] - is element, not an a arrKey :)
|
|
||
|
|
||
| function solution(arr) { | ||
| for (let key in arr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use for loop instead of for-in.
for-in much slower than for loop
| function unknownAge(arr) { | ||
| let newArr = []; | ||
| for (let key in arr) { | ||
| let arrKey = arr[key]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the arrKey name could be improved, it's just simple an a element for example
| return newArr; | ||
| } | ||
| console.log(solution(array)); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove blank lines
No description provided.